import request from '@/utils/request.js'
import { useTokenStore } from '@/stores/token'

//文章分类列表查询
export const articleCategoryListService = () => {
    //tokenStore = useTokenStore();
    //return request.get('/category',{headers:{'Authorization':tokenStore.token}})
    return request.get('/category')
}

//添加文章分类
export const articleCategoryAddService = (categoryModel) => {
    return request.post('/category', categoryModel)
}

//更新文章分类
export const articleCategoryUpdateService = (categoryData) => {
    return request.put('/category', categoryData)
}

//删除分类
export const articleCategoryDeleteService = (id) => {
    return request.delete('/category?id=' + id)
}

//文章列表查询
export const articleListService = (params) => {
    return request.get('/article', { params: params })
}

//文章添加
export const articleAddService = (articleData) => {
    return request.post('/article', articleData);
}

//文章修改
export const articleUpdateService = (articleData) => {
    return request.put('/article', articleData)
}

//文章删除
export const articleDeleteService = (id)=>{
    return request.delete('/article?id=' + id)
}